<template>
  <div class="home">
    <TopInfo />
    <div class="top-tabs">
      <div class="main-content">
        <div class="tabs-line">
          <img :src="logo" class="logo-img fl" @click="ToHome" />
          <span class="fl">
            <span>{{ city }}</span>
            <el-select
              v-model="value"
              placeholder="【切换城市】"
              size="mini"
              class="change-city"
              @change="ChangeCity"
            >
              <el-option label="长沙市" value="长沙市"></el-option>
              <el-option label="株洲市" value="株洲市"></el-option>
              <el-option label="湘潭市" value="湘潭市"></el-option>
              <el-option label="衡阳市" value="衡阳市"></el-option>
              <el-option label="邵阳市" value="邵阳市"></el-option>
              <el-option label="岳阳市" value="岳阳市"></el-option>
              <el-option label="常德市" value="常德市"></el-option>
              <el-option label="张家界市" value="张家界市"></el-option>
              <el-option label="益阳市" value="益阳市"></el-option>
              <el-option label="郴州市" value="郴州市"></el-option>
              <el-option label="永州市" value="永州市"></el-option>
              <el-option label="怀化市" value="怀化市"></el-option>
              <el-option label="娄底市" value="娄底市"></el-option>
              <el-option
                label="湘西土家族苗族自治州"
                value="湘西土家族苗族自治州"
              ></el-option>
            </el-select>
          </span>
          <div class="fr fr-tabs">
            <!-- <span @click="ToHome">首页</span>
						<span @click="ToNews">政策快报</span>
						<span @click="ToMatching()">政策匹配</span>
						<span @click="ToRe(4, 1)">找项目</span>
						<span @click="ToRe(5, 2)">找人才</span>
						<span @click="ToRe(6, 3)">找服务机构</span> -->
            <el-menu
              :default-active="activeIndex"
              class="el-menu-demo right-menu"
              mode="horizontal"
              @select="handleSelect"
            >
              <!-- <el-menu-item
                v-for="(item, index) in menuList"
                :key="item.Id"
                :index="index.toString()"
                >{{ item.TypeName }}</el-menu-item
              > -->
              <el-submenu index="1" v-if="menuList[0]">
                <template slot="title">{{ menuList[0].TypeName }}</template>
                <el-submenu
                  v-for="item in menuList[0].Children"
                  :key="item.Id"
                  :index="item.Id.toString()"
                >
                  <template slot="title">
                    {{ item.TypeName ? item.TypeName : "" }}
                  </template>
                  <el-menu-item
                    v-for="item2 in item.Children"
                    :key="item2.Id"
                    @click="ToService(item2.Id, item2.Url, item2.TypeName)"
                    :index="item2.Id.toString()"
                  >
                    {{ item2.TypeName ? item2.TypeName : "" }}
                  </el-menu-item>
                </el-submenu>
              </el-submenu>
              <el-submenu index="2" v-if="menuList[1]">
                <template slot="title">{{ menuList[1].TypeName }}</template>
                <el-menu-item
                  v-for="item in menuList[1].Children"
                  :key="item.Id"
                  :index="item.Id.toString()"
                  @click="ToService(item.Id, item.Url, item.TypeName)"
                  >{{ item.TypeName }}</el-menu-item
                >
              </el-submenu>
              <el-submenu index="3" v-if="menuList[2]">
                <template slot="title">{{ menuList[2].TypeName }}</template>
                <el-menu-item
                  v-for="item in menuList[2].Children"
                  :key="item.Id"
                  :index="item.Id.toString()"
                  @click="ToService(item.Id, item.Url, item.TypeName)"
                  >{{ item.TypeName }}</el-menu-item
                >
              </el-submenu>
              <el-submenu index="4" v-if="menuList[3]">
                <template slot="title">{{ menuList[3].TypeName }}</template>
                <el-submenu
                  v-for="item in menuList[3].Children"
                  :key="item.Id"
                  :index="item.Id.toString()"
                >
                  <template slot="title">
                    {{ item.TypeName ? item.TypeName : "" }}
                  </template>
                  <el-menu-item
                    v-for="item2 in item.Children"
                    :key="item2.Id"
                    :index="item2.Id.toString()"
                    @click="ToService(item2.Id, item2.Url, item2.TypeName)"
                  >
                    {{ item2.TypeName ? item2.TypeName : "" }}
                  </el-menu-item>
                </el-submenu>
              </el-submenu>
              <el-submenu index="5" v-if="menuList[4]">
                <template slot="title">{{ menuList[4].TypeName }}</template>
                <el-menu-item
                  v-for="item in menuList[4].Children"
                  :key="item.Id"
                  :index="item.Id.toString()"
                  @click="ToService(item.Id, item.Url, item.TypeName)"
                  >{{ item.TypeName }}</el-menu-item
                >
              </el-submenu>
              <el-menu-item index="6" v-if="menuList[5]" @click="ToAboutUs">{{
                menuList[5].TypeName
              }}</el-menu-item>
            </el-menu>
            <!-- <el-popover
              placement="bottom"
              trigger="hover"
              class="pop"
              v-for="(item, index) in menuList"
              :key="item.Id"
            >
              <ul class="aul" v-if="index == 0 || index == 3">
                <li class="ali" v-for="item2 in item.Children" :key="item2.Id">
                  <div
                    class="aa"
                    @click="ToService(item2.Id, item2.Url, item2.TypeName)"
                  >
                    {{ item2.TypeName }}
                  </div>
                  <ul class="aaul">
                    <li
                      class="aali"
                      v-for="item3 in item2.Children"
                      :key="item3.Id"
                      @click="ToService(item3.Id, item3.Url, item3.TypeName)"
                    >
                      {{ item3.TypeName }}
                    </li>
                  </ul>
                </li>
              </ul>
              <ul class="aul" v-else>
                <li class="ali" v-if="item.Children.length > 0">
                  <ul class="aaul">
                    <li
                      class="aali"
                      v-for="item2 in item.Children"
                      :key="item2.Id"
                      @click="ToService(item2.Id, item2.Url, item2.TypeName)"
                    >
                      {{ item2.TypeName }}
                    </li>
                  </ul>
                </li>
                <li v-else>
                  <ul class="aaul">
                    <li
                      class="aali"
                      @click="ToService(item.Id, item.Url, item.TypeName)"
                    >
                      {{ item.TypeName }}
                    </li>
                  </ul>
                </li>
              </ul>
              <div
                slot="reference"
                @click="ToService(item.Id, item.Url, item.TypeName)"
              >
                {{ item.TypeName }}
              </div>
            </el-popover> -->
          </div>
        </div>
        <img :src="title" class="title-img" />
        <div class="tabs">
          <span :class="active == 0 ? 'active' : ''" @click="Find(0)"
            >查企业</span
          >
          <span :class="active == 1 ? 'active' : ''" @click="Find(1)"
            >政策匹配</span
          >
          <span :class="active == 2 ? 'active' : ''" @click="Find(2)"
            >找项目</span
          >
          <span :class="active == 3 ? 'active' : ''" @click="Find(3)"
            >找人才</span
          >
          <span :class="active == 4 ? 'active' : ''" @click="Find(4)"
            >找专家</span
          >
          <span :class="active == 5 ? 'active' : ''" @click="Find(5)"
            >找服务机构</span
          >
        </div>
        <div class="search-div">
          <el-select
            v-if="active == 0 || active == 1"
            v-model="keywords"
            filterable
            remote
            reserve-keyword
            :placeholder="
              active == 0 ? '请输入要查询地企业' : '请输入你要匹配的公司'
            "
            :remote-method="remoteMethod"
            :loading="loading"
            class="search-select search-ipt"
          >
            <el-option
              v-for="item in options"
              :key="item.EntId"
              :label="item.EntName"
              :value="item.EntName"
            >
            </el-option>
          </el-select>
          <el-input
            v-else
            :placeholder="
              active == 2
                ? '请输入你要查找的项目名称'
                : active == 3
                ? '请输入你要查找的人才名称'
                : active == 4
                ? '请输入你要查找的专家名称'
                : '请输入你要查找的服务机构'
            "
            v-model="keywords2"
            clearable
            class="fl search-ipt"
          ></el-input>

          <el-button
            type="warning"
            class="fr search-btn"
            icon="el-icon-search"
            @click="Search()"
            >搜索</el-button
          >
        </div>
      </div>
    </div>
    <div class="router-tabs">
      <span @click="ToRe(5, 1)">
        <img :src="zxm" />
        <div>找项目</div>
      </span>
      <span @click="ToRe(6, 2)">
        <img :src="zrc" />
        <div>找人才</div>
      </span>
      <span @click="ToExpert()">
        <img :src="gywm" />
        <div>找专家</div>
      </span>
      <span @click="ToRe(8, 3)">
        <img :src="ztrz" />
        <div>找服务机构</div>
      </span>
      <span @click="ToNews">
        <img :src="zckx" />
        <div>政策快报</div>
      </span>
      <span @click="ToMatching()">
        <img :src="sbpp" />
        <div>政策匹配</div>
      </span>
    </div>
    <div class="big-data-center">
      <div class="policy-center info-cont">
        <img :src="zc" class="fl" />
        <img :src="cysjzx" class="fl" />
        <span>发现数据价值</span>
      </div>
      <div class="data-center info-cont">
        <div class="maps">
          <Hunan
            @fatherMethod="getCity"
            @tocityMethod="toCity"
            v-if="IsHunan"
          />
          <City @back="back" @fatherMethod="getArea" v-else />
        </div>
        <div class="datas">
          <div class="all-data">
            <p>
              {{ area }}
              <span class="fr backspan" @click="back"> 返回 </span>
            </p>
            <ul class="data-list">
              <li
                v-for="(item, index) in allData"
                :key="index"
                @click="ToInstry(item)"
              >
                <div class="data-title">
                  {{ item.split(":")[0] }}
                </div>
                <div class="data-acount">
                  <span>{{ item.split(":")[1] }}</span
                  >{{ item.split(":")[2] }}
                </div>
              </li>
              <!-- <li>
                <div class="data-title">服务企业</div>
                <div class="data-acount">
                  <span>{{ allData[1] }}</span
                  >个
                </div>
              </li>
              <li>
                <div class="data-title">科技型中小企业</div>
                <div class="data-acount">
                  <span>{{ allData[2] }}</span
                  >个
                </div>
              </li>
              <li>
                <div class="data-title">高新技术企业</div>
                <div class="data-acount">
                  <span>{{ allData[3] }}</span
                  >个
                </div>
              </li>
              <li>
                <div class="data-title">省专精特新小巨人</div>
                <div class="data-acount">
                  <span>{{ allData[4] }}</span
                  >个
                </div>
              </li>
              <li>
                <div class="data-title">国家专精特新小巨人</div>
                <div class="data-acount">
                  <span>{{ allData[5] }}</span
                  >个
                </div>
              </li>
              <li>
                <div class="data-title">市级创新平台</div>
                <div class="data-acount">
                  <span>{{ allData[6] }}</span
                  >个
                </div>
              </li>
              <li>
                <div class="data-title">省级创新平台</div>
                <div class="data-acount">
                  <span>{{ allData[7] }}</span
                  >个
                </div>
              </li>
              <li>
                <div class="data-title">国家级创新平台</div>
                <div class="data-acount">
                  <span>{{ allData[8] }}</span
                  >个
                </div>
              </li>
              <li>
                <div class="data-title">专利</div>
                <div class="data-acount">
                  <span>{{ allData[9] }}</span
                  >个
                </div>
              </li>
              <li>
                <div class="data-title">商标</div>
                <div class="data-acount">
                  <span>{{ allData[10] }}</span
                  >个
                </div>
              </li>
              <li>
                <div class="data-title">软件著作权</div>
                <div class="data-acount">
                  <span>{{ allData[11] }}</span
                  >个
                </div>
              </li>
              <li>
                <div class="data-title">研发费用</div>
                <div class="data-acount">
                  <span>{{ allData[12] }}</span
                  >万元
                </div>
              </li>
              <li>
                <div class="data-title">技术合同登记</div>
                <div class="data-acount">
                  <span>{{ allData[13] }}</span
                  >万元
                </div>
              </li>
              <li>
                <div class="data-title">产学研合作</div>
                <div class="data-acount">
                  <span>{{ allData[14] }}</span
                  >个
                </div>
              </li>
              <li>
                <div class="data-title">服务机构</div>
                <div class="data-acount">
                  <span>{{ allData[15] }}</span
                  >个
                </div>
              </li>
              <li>
                <div class="data-title">专家导师</div>
                <div class="data-acount">
                  <span>{{ allData[16] }}</span
                  >个
                </div>
              </li>
              <li>
                <div class="data-title">高层次人才</div>
                <div class="data-acount">
                  <span>{{ allData[17] }}</span
                  >个
                </div>
              </li> -->
            </ul>
          </div>
          <div class="data-hot">
            <p>
              政策热点
              <span class="fr backspan" @click="ToNews"> 更多>> </span>
            </p>
            <div id="box">
              <ul id="hot-list" :class="{ anim: animate == true }">
                <li
                  @click="ToNewsDetail(item.Id)"
                  v-for="item in newsData"
                  :key="item.Id"
                >
                  {{ item.Title }}
                </li>
              </ul>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="newnews">
      <div>
        <div class="data-hot">
          <p>
            专家
            <span class="fr backspan" @click="ToExpert()"> 更多>> </span>
          </p>
          <div class="box">
            <ul id="hot-list" :class="{ anim: animate == true }">
              <li
                @click="ToExpertDetail(item.Id)"
                v-for="item in newsData1"
                :key="item.Id"
              >
                {{ item.Pername }}
              </li>
            </ul>
          </div>
        </div>
      </div>
      <div>
        <div class="data-hot">
          <p>
            人才
            <span class="fr backspan" @click="ToRe(6, 2)"> 更多>> </span>
          </p>
          <div class="box">
            <ul id="hot-list" :class="{ anim: animate == true }">
              <li
                @click="ToResourceDetail(2, item.Id)"
                v-for="item in newsData2"
                :key="item.Id"
              >
                {{ item.Pername }}
              </li>
            </ul>
          </div>
        </div>
      </div>
      <div>
        <div class="data-hot">
          <p>
            项目
            <span class="fr backspan" @click="ToRe(5, 1)"> 更多>> </span>
          </p>
          <div class="box">
            <ul id="hot-list" :class="{ anim: animate == true }">
              <li
                @click="ToResourceDetail(1, item.Id)"
                v-for="item in newsData3"
                :key="item.Id"
              >
                {{ item.ProName }}
              </li>
            </ul>
          </div>
        </div>
      </div>
      <div>
        <div class="data-hot">
          <p>
            机构
            <span class="fr backspan" @click="ToRe(8, 3)"> 更多>> </span>
          </p>
          <div class="box">
            <ul id="hot-list" :class="{ anim: animate == true }">
              <li
                @click="ToResourceDetail(3, item.Id)"
                v-for="item in newsData4"
                :key="item.Id"
              >
                {{ item.CompanyName }}
              </li>
            </ul>
          </div>
        </div>
      </div>
    </div>
    <div class="report">
      <div class="report-data">
        <ul class="report-data-list fl">
          <li :class="isShow == 1 ? 'active' : ''" @click="isShow = 1">
            <i class="el-icon-s-data"></i>入库企业统计
          </li>
          <li :class="isShow == 2 ? 'active' : ''" @click="isShow = 2">
            <i class="el-icon-coin"></i>入库企业年增长
          </li>
          <li :class="isShow == 3 ? 'active' : ''" @click="isShow = 3">
            <i class="el-icon-pie-chart"></i>企业知识产权统计
          </li>
          <li :class="isShow == 4 ? 'active' : ''" @click="isShow = 4">
            <i class="el-icon-coin"></i>知识产权年增长
          </li>
          <li :class="isShow == 5 ? 'active' : ''" @click="isShow = 5">
            <i class="el-icon-pie-chart"></i>荣誉资质统计
          </li>
          <li :class="isShow == 6 ? 'active' : ''" @click="isShow = 6">
            <i class="el-icon-coin"></i>高企年增长统计
          </li>
          <li :class="isShow == 7 ? 'active' : ''" @click="isShow = 7">
            <i class="el-icon-coin"></i>科小年增长统计
          </li>
          <li :class="isShow == 8 ? 'active' : ''" @click="isShow = 8">
            <i class="el-icon-s-data"></i>技术交易额统计
          </li>
          <li :class="isShow == 9 ? 'active' : ''" @click="isShow = 9">
            <i class="el-icon-s-data"></i>研发费用投入统计
          </li>
          <!-- <li><i class="el-icon-pie-chart"></i>科小年增长图</li> -->
        </ul>
        <div class="data-echart fr">
          <!-- <BarEchart /> -->
          <BarEchart v-if="isShow == 1" />
          <LineEchart v-if="isShow == 2" />
          <PieEchart v-if="isShow == 3" />
          <LineEchart2 v-if="isShow == 4" />
          <PieEchart2 v-if="isShow == 5" />
          <LineEchart3 v-if="isShow == 6" />
          <LineEchart4 v-if="isShow == 7" />
          <BarEchart2 v-if="isShow == 8" />
          <BarEchart3 v-if="isShow == 9" />
        </div>
      </div>
    </div>
    <BottomInfo />
  </div>
</template>

<script>
import Hunan from "../components/Hunan";
import City from "../components/City";
import BottomInfo from "../components/BottomInfo";
import TopInfo from "../components/TopInfo";
import BarEchart from "../components/BarEchart";
import LineEchart from "../components/LineEchart";
import LineEchart2 from "../components/LineEchart2";
import LineEchart3 from "../components/LineEchart3";
import LineEchart4 from "../components/LineEchart4";
import PieEchart from "../components/PieEchart";
import PieEchart2 from "../components/PieEchart2";
import BarEchart2 from "../components/BarEchart2";
import BarEchart3 from "../components/BarEchart3";
// import Vue from "vue"
export default {
  name: "Home",
  data() {
    return {
      activeIndex: "1",
      logo: require("../assets/images/logo.png"),
      title: require("../assets/images/title2.png"),
      zxm: require("../assets/images/zxm.png"),
      zrc: require("../assets/images/zrc.png"),
      ztrz: require("../assets/images/ztrz.png"),
      zckx: require("../assets/images/zckx.png"),
      sbpp: require("../assets/images/sbpp.png"),
      gywm: require("../assets/images/gywm.png"),
      zc: require("../assets/images/zc.png"),
      zcsjzx: require("../assets/images/zcsjzx.png"),
      cysjzx: require("../assets/images/cysjzx.png"),
      active: 0,
      keywords: "",
      keywords2: "",
      city: "",
      value: "",
      options: [],
      loading: false,
      newsData: [],
      newsData1: [],
      newsData2: [],
      newsData3: [],
      newsData4: [],
      // barData: [],
      isShow: 1,
      allData: [],
      animate: false,
      area: "湖南省数据",
      menuList: [],
      IsHunan: true,
      arr: [],
      // placeholder:"请输入你要匹配的公司"
    };
  },
  created() {},
  methods: {
    back() {
      this.IsHunan = true;
      this.GetMapData("");
      this.area = "湖南省数据";
      this.$cookies.set("areaname", "");
      this.$cookies.set("cityname", "");
    },
    handleSelect(key, keyPath) {
      // console.log(key);
      this.$cookies.set("keys2", key);
    },
    ToService(id, url, title) {
      // console.log(id, url, title);
      if (url != 0) {
        if (url == 1) {
          this.$router.push({ name: "Service" });
          this.$cookies.set("newid", id);
        } else if (url == 2) {
          this.$router.push({ name: "AddForm" });
          this.$cookies.set("newid", id);
          this.$cookies.set("title", title);
        } else if (title == "专家库") {
          this.$router.push({ name: "Expert" });
          this.$cookies.set("newid", id);
          this.$cookies.set("TopActive", 7);
        } else if (title == "项目库") {
          this.$router.push({
            name: "Resource",
            params: { Type: 1, Keywords: "" },
          });
          this.$cookies.set("newid", id);
          this.$cookies.set("TopActive", 5);
        } else if (title == "人才库") {
          this.$router.push({
            name: "Resource",
            params: { Type: 2, Keywords: "" },
          });
          this.$cookies.set("newid", id);
          this.$cookies.set("TopActive", 6);
        } else {
          // let newUrl = this.$router.resolve({
          //   path: url,
          // });
          window.open(url);
        }
      }
    },
    Find(n) {
      this.active = n;
    },
    scroll() {
      //   console.log(111);
      this.animate = true; // 因为在消息向上滚动的时候需要添加css3过渡动画，所以这里需要设置true
      setTimeout(() => {
        //  这里直接使用了es6的箭头函数，省去了处理this指向偏移问题，代码也比之前简化了很多
        this.newsData.push(this.newsData?.[0]); // 将数组的第一个元素添加到数组的
        this.newsData.shift(); //删除数组的第一个元素
        this.newsData1.push(this.newsData2?.[0]); // 将数组的第一个元素添加到数组的
        this.newsData1.shift(); //删除数组的第一个元素
        this.newsData2.push(this.newsData2?.[0]); // 将数组的第一个元素添加到数组的
        this.newsData2.shift(); //删除数组的第一个元素
        this.newsData3.push(this.newsData3?.[0]); // 将数组的第一个元素添加到数组的
        this.newsData3.shift(); //删除数组的第一个元素
        this.newsData4.push(this.newsData4?.[0]); // 将数组的第一个元素添加到数组的
        this.newsData4.shift(); //删除数组的第一个元素
        this.animate = false; // margin-top 为0 的时候取消过渡动画，实现无缝滚动
      }, 1000);
    },
    ChangeCity(value) {
      //console.log(value);
      this.city = value;
      this.value = "";
      this.$cookies.set("city", value);
    },
    ToHome() {
      this.$router.push({ name: "Home" });
    },
    ToNews() {
      this.$router.push({ name: "News" });
      this.$cookies.set("TopActive", 3);
    },
    ToCompany(data) {
      this.$router.push({ name: "Company", params: { Keywords: data } });
      this.$cookies.set("TopActive", 2);
    },
    ToMatching(data) {
      this.$router.push({ name: "Matching", params: { Keywords: data } });
      this.$cookies.set("TopActive", 4);
    },
    ToExpert(data) {
      console.log(data);
      this.$router.push({ name: "Expert", params: { Keywords: data } });
      this.$cookies.set("TopActive", 7);
    },
    ToRe(tabs, n, data) {
      this.$router.push({
        name: "Resource",
        params: { Type: n, Keywords: data },
      });
      this.$cookies.set("TopActive", tabs);
    },
    ShowRk() {
      this.isShow = 1;
    },
    ToAboutUs() {
      this.$router.push({ name: "AboutUs" });
      this.$cookies.set("TopActive", 9);
    },
    ToInstry(data) {
      // console.log(data);
      this.$router.push({ name: "Industry" });
      this.$cookies.set("industrytypename", data.split(":")[0]);
      this.$cookies.set("TopActive", 9);
    },
    remoteMethod(value) {
      //console.log(value);
      this.loading = true;
      this.$axios
        .get("/Ent/GetEntNameByEs", {
          params: {
            key: value,
          },
        })
        .then((res) => {
          //console.log(res);
          this.loading = false;
          this.options = res.data.data;
        })
        .catch((err) => {
          //console.log(err);
        });
    },
    Search() {
      //console.log(this.keywords);
      //console.log(this.active);
      if (this.active == 0) {
        this.ToCompany(this.keywords);
      } else if (this.active == 1) {
        this.ToMatching(this.keywords);
      } else if (this.active == 4) {
        this.ToExpert(this.keywords2);
      } else if (this.active == 2) {
        this.ToRe(5, 1, this.keywords2);
      } else if (this.active == 3) {
        this.ToRe(6, 2, this.keywords2);
      } else if (this.active == 5) {
        this.ToRe(8, 3, this.keywords2);
      } else {
        // this.ToRe(this.active + 4, this.active, this.keywords2);
      }
    },
    GetList() {
      this.$axios({
        url: "/Policy/GetPolicyList",
        method: "post",
        data: {
          limit: 5,
          page: 1,
          day: 0,
          typeid: 1,
          title: "",
          userdata: this.$cookies.get("userdata"),
        },
        transformRequest: [
          function (data) {
            let ret = "";
            for (let it in data) {
              ret +=
                encodeURIComponent(it) +
                "=" +
                encodeURIComponent(data[it]) +
                "&";
            }
            return ret;
          },
        ],
        headers: {
          "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
        },
      })
        .then((res) => {
          //console.log(res.data.data);
          // this.count = res.data.count;
          let rows = res.data.data;
          // this.loading = false;
          // if (rows == null || rows.length === 0) {
          // 加载结束
          // this.finished = true;
          // return;
          // }
          this.newsData = res.data.data;
          // this.newsData = this.newsData.concat(rows);
          // this.isLoading = false;
        })
        .catch((err) => {
          //console.log(err);
        });
    },
    GetList2() {
      this.$axios({
        url: "/New/GetNewTypeList",
        method: "post",
        data: {
          limit: 10,
          page: 1,
          day: 0,
          typeid: 1,
          title: "",
          userdata: this.$cookies.get("userdata"),
        },
        transformRequest: [
          function (data) {
            let ret = "";
            for (let it in data) {
              ret +=
                encodeURIComponent(it) +
                "=" +
                encodeURIComponent(data[it]) +
                "&";
            }
            return ret;
          },
        ],
        headers: {
          "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
        },
      })
        .then((res) => {
          this.menuList = res.data.data;
        })
        .catch((err) => {
          //console.log(err);
        });
    },
    GetMapData(city, type) {
      this.$axios({
        url: "/Statist/GetMapDataInfo",
        method: "post",
        data:
          type == "city"
            ? {
                city,
              }
            : {
                area: city,
              },
        transformRequest: [
          function (data) {
            let ret = "";
            for (let it in data) {
              ret +=
                encodeURIComponent(it) +
                "=" +
                encodeURIComponent(data[it]) +
                "&";
            }
            return ret;
          },
        ],
        headers: {
          "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
        },
      })
        .then((res) => {
          // console.log(res);
          this.allData = res.data.data.split("|");
          // console.log(this.allData);
        })
        .catch((err) => {
          console.log(err);
        });
    },
    getData1() {
      let url = "/Resource/GetExpertList";
      //console.log(url);
      this.$axios({
        url: url,
        method: "post",
        data: {
          limit: 10,
          page: 1,
        },
        transformRequest: [
          function (data) {
            let ret = "";
            for (let it in data) {
              ret +=
                encodeURIComponent(it) +
                "=" +
                encodeURIComponent(data[it]) +
                "&";
            }
            return ret;
          },
        ],
        headers: {
          "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
        },
      })
        .then((res) => {
          //console.log(res.data.data);
          this.newsData1 = res.data.data;
        })
        .catch((err) => {
          //console.log(err);
        });
    },
    getData2() {
      let url = "/Resource/GetPersonnelList";
      //console.log(url);
      this.$axios({
        url: url,
        method: "post",
        data: {
          limit: 10,
          page: 1,
        },
        transformRequest: [
          function (data) {
            let ret = "";
            for (let it in data) {
              ret +=
                encodeURIComponent(it) +
                "=" +
                encodeURIComponent(data[it]) +
                "&";
            }
            return ret;
          },
        ],
        headers: {
          "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
        },
      })
        .then((res) => {
          //console.log(res.data.data);
          this.newsData2 = res.data.data;
        })
        .catch((err) => {
          //console.log(err);
        });
    },
    getData3() {
      let url = "/Resource/GetProjectList";
      //console.log(url);
      this.$axios({
        url: url,
        method: "post",
        data: {
          limit: 10,
          page: 1,
        },
        transformRequest: [
          function (data) {
            let ret = "";
            for (let it in data) {
              ret +=
                encodeURIComponent(it) +
                "=" +
                encodeURIComponent(data[it]) +
                "&";
            }
            return ret;
          },
        ],
        headers: {
          "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
        },
      })
        .then((res) => {
          //console.log(res.data.data);
          this.newsData3 = res.data.data;
        })
        .catch((err) => {
          //console.log(err);
        });
    },
    getData4() {
      let url = "/Resource/GetFinanceList";
      //console.log(url);
      this.$axios({
        url: url,
        method: "post",
        data: {
          limit: 10,
          page: 1,
        },
        transformRequest: [
          function (data) {
            let ret = "";
            for (let it in data) {
              ret +=
                encodeURIComponent(it) +
                "=" +
                encodeURIComponent(data[it]) +
                "&";
            }
            return ret;
          },
        ],
        headers: {
          "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
        },
      })
        .then((res) => {
          //console.log(res.data.data);
          this.newsData4 = res.data.data;
        })
        .catch((err) => {
          //console.log(err);
        });
    },
    ToNewsDetail(id) {
      this.$router.push({ name: "NewsDetail", query: { id } });
      this.$cookies.set("TopActive", 9);
    },
    ToExpertDetail(id) {
      let api = "ExpertDetail";
      this.$router.push({ name: api, params: { id } });
      this.$cookies.set("TopActive", 9);
    },
    ToResourceDetail(n, id) {
			let api = "";
			if (n == 1) {
				api = "ResourceDetailPro";
			} else if (n == 2) {
				api = "ResourceDetailPer";
			} else {
				api = "ResourceDetailFin";
			}
			this.$router.push({ name: api, params: { id } });
			this.$cookies.set("TopActive", 9);
		},
    getCity(city) {
      // console.log(city);
      this.GetMapData(city.name, "city");
      this.area = city.name + "数据";
      this.$cookies.set("cityname", city.name);
      this.$cookies.set("areaname", "");
    },
    getArea(area) {
      // console.log(city);
      this.GetMapData(area.name, "area");
      this.area = area.name + "数据";
      this.$cookies.set("areaname", area.name);
      this.$cookies.set("cityname", "");
    },
    toCity(city) {
      console.log(city.name);
      this.IsHunan = false;
      this.$cookies.set("selectCity", city.name);
    },
  },
  created() {
    this.GetList2();
  },
  mounted() {
    // console.log(this.$cookies.get("userinfo"));
    this.getData1();
    this.getData2();
    this.getData3();
    this.getData4();
    setInterval(this.scroll, 2000);
    if (this.$cookies.get("city")) {
      this.city = this.$cookies.get("city");
    } else {
      this.$axios({
        url: "/User/GetCity",
        method: "post",
        transformRequest: [
          function (data) {
            let ret = "";
            for (let it in data) {
              ret +=
                encodeURIComponent(it) +
                "=" +
                encodeURIComponent(data[it]) +
                "&";
            }
            return ret;
          },
        ],
        headers: {
          "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
        },
      })
        .then((res) => {
          // console.log(res.data);
          if (res.data.status == 1) {
            this.city = res.data.data;
            this.$cookies.set("city", res.data.data);
          }
        })
        .catch((err) => {
          console.log(err);
        });
    }
    this.GetList();
    this.GetMapData("");
    this.$cookies.set("areaname", "");
    this.$cookies.set("cityname", "");
  },
  components: {
    Hunan,
    City,
    BottomInfo,
    TopInfo,
    BarEchart,
    LineEchart,
    LineEchart2,
    LineEchart3,
    LineEchart4,
    PieEchart,
    PieEchart2,
    BarEchart2,
    BarEchart3,
  },
};
</script>

<style scoped>
.home {
  min-height: 1200px;
}
.info-cont {
  width: 1200px;
  margin: 0 auto;
}

.top-tabs {
  height: 450px;
  background-image: url(../assets/images/banner2.jpg);
  background-repeat: no-repeat;
  background-position: center center;
  background-size: 100% 100%;
  box-sizing: border-box;
  padding: 30px 0;
  min-width: 1200px;
  /* padding: 25px 30px; */
}
.main-content {
  width: 1200px;
  margin: 0 auto;
}
.tabs-line {
  height: 60px;
  line-height: 60px;
  /* overflow: hidden; */
  color: #ccc;
  font-size: 16px;
}
.logo-img {
  height: 30px;
  margin-right: 26px;
  position: relative;
  top: 15px;
  cursor: pointer;
}
.fr-tabs {
  overflow: hidden;
}
.fr-tabs .pop {
  float: left;
  margin-left: 50px;
  cursor: pointer;
  font-size: 14px;
}
.fr-tabs .pop:hover {
  /* text-decoration: underline; */
  color: #fff;
}
.title-img {
  display: block;
  width: 587px;
  margin: 70px auto 43px auto;
}
.tabs {
  display: flex;
  width: 600px;
  margin: 0 auto;
  color: #fff;
  font-size: 18px;
  text-align: center;
  cursor: pointer;
  /* position: relative;
  right: 250px; */
}
.tabs span {
  flex: 1;
  padding: 5px;
}
.tabs span.active {
  color: #095aff;
  background-color: #fff;
  border-radius: 2px;
  box-sizing: border-box;
  position: relative;
}
.tabs span.active::after {
  content: "";
  position: absolute;
  left: calc(50% - 4px);
  bottom: -8px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid #fff;
}
.search-div {
  width: 911px;
  height: 60px;
  margin: 0 auto;
  margin-top: 30px;
}
.search-ipt {
  width: 760px;
  height: 60px;
  font-size: 18px;
}
.search-btn {
  width: 125px;
  height: 60px;
  font-size: 24px;
}
.router-tabs {
  display: flex;
  width: 1200px;
  margin: auto;
  margin-top: 43px;
  /* border-bottom: 1px solid #ececec; */
  padding-bottom: 42px;
}
.router-tabs span {
  flex: 1;
  text-align: center;
  font-size: 16px;
  color: #333;
  cursor: pointer;
}
.router-tabs span img {
  width: 52px;
  height: 50px;
  /* display: block; */
}
.policy-center {
  height: 30px;
  line-height: 30px;
  color: #333;
  font-size: 14px;
  margin-top: 40px;
  margin-bottom: 40px;
}
.policy-center img {
  height: 30px;
  margin-right: 20px;
}
.big-data-center {
  border-top: 1px solid #ececec;
  border-bottom: 1px solid #ececec;
}
.data-center {
  overflow: hidden;
  height: 880px;
  /* background-color: pink; */
}
.maps {
  float: left;
  width: 700px;
  height: 800px;
}
.datas {
  float: right;
  width: 500px;
  height: 800px;
}
.all-data,
.data-hot {
  background-color: #f9f9f9;
  /* padding: 10px 30px 10px 30px; */
  box-sizing: border-box;
  overflow: hidden;
  border-radius: 5px;
}
.all-data p,
.data-hot p {
  color: #fff;
  font-size: 22px;
  height: 40px;
  line-height: 40px;
  /* font-weight: bold; */
  background-color: #095aff;
  /* padding-bottom: 10px; */
  padding: 5px 20px;
  border-bottom: 1px solid #d9d9d9;
}
.data-list {
  overflow: hidden;
  padding: 20px 0 0 0;
}
.data-list li {
  float: left;
  width: 33.3%;
  font-size: 16px;
  color: #000;
  margin-bottom: 15px;
  text-align: center;
  cursor: pointer;
}
.data-title {
  margin-bottom: 10px;
}
.data-acount span {
  font-weight: bold;
  color: #095aff;
  margin-right: 5px;
}
.data-hot {
  margin-top: 20px;
}
#box {
  /* width: 300px; */
  height: 200px;
  overflow: hidden;
  /* padding-left: 30px;
    border: 1px solid black; */
}
.box {
  /* width: 300px; */
  height: 400px;
  overflow: hidden;
  /* padding-left: 30px;
    border: 1px solid black; */
}
#hot-list {
  color: #000000;
  font-size: 14px;
  padding: 20px;
  /* height: 356px;
  overflow: hidden; */
}
#hot-list li {
  margin-bottom: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
#hot-list li:hover {
  color: #095aff;
}
.report {
  height: 1000px;
  background-image: url(../assets/images/report.png);
  background-repeat: no-repeat;
  background-position: center center;
  background-size: 100% 100%;
  box-sizing: border-box;
  padding: 50px 0;
}
.report-data {
  width: 1200px;
  height: 900px;
  margin: 0 auto;
  box-sizing: border-box;
  overflow: hidden;
  box-shadow: 0px 7px 40px 0px rgba(14, 55, 141, 0.22);
  border-radius: 20px;
}
.report-data-list {
  width: 350px;
  height: 100%;
  background-color: #e9f7ff;
}
.report-data-list li {
  height: 100px;
  line-height: 100px;
  padding-left: 80px;
  font-size: 18px;
  box-sizing: border-box;
  color: #333;
  cursor: pointer;
}
.report-data-list li i {
  font-size: 24px;
  margin-right: 10px;
  position: relative;
  top: 3px;
}
.report-data-list li.active {
  background-color: #095aff;
  color: #fff;
}
.data-echart {
  width: 850px;
  height: 100%;
  background-color: #fff;
}
.right-menu {
}
.aul {
  overflow: hidden;
}
.ali {
  float: left;
  width: 130px;
}
.aa {
  font-size: 14px;
  font-family: PingFang SC;
  font-weight: 700;
  padding-bottom: 15px;
  cursor: pointer;
  color: #182c49;
  border-bottom: 1px solid rgba(204, 205, 209, 0.6);
}
.aali {
  margin-top: 14px;
  font-size: 12px;
  font-family: PingFang SC;
  font-weight: 400;
  cursor: pointer;
}
.aaul .aali:first-child {
  margin-top: 0;
}
.backspan {
  cursor: pointer;
  font-size: 16px;
  color: #fff;
  line-height: 40px;
}
.newnews {
  /* display: flex; */
  overflow: hidden;
  width: 1200px;
  margin: 20px auto;
}
.newnews > div {
  float: left;
  width: 285px;
  margin-right: 20px;
}
.newnews > div:last-child {
  margin-right: 0;
}
</style>
